<ul class="sideNav">
<?php

/**
 * Generate an anchor tag for an admin submenu
 * @return anchor tag
 */
function admin_submenu($target, $title, $icon, $active)
{
	$link = 'admin/'.$target;
	if ($active) {
		echo '<li>'.anchor($link, icon_tag($icon).$title, 'class="active"').'</li>';
	}
	else {
		echo '<li>'.anchor($link, icon_tag($icon).$title).'</li>';
	}
}

$sub = $context['sub_navigation'];
switch ($context['main_navigation']) {
	case 'site':
		admin_submenu('contents',  'Pages du site', 'page_white_stack', $sub == 'contents');
		admin_submenu('posts',     'Actualités', 'newspaper',           $sub == 'posts');
		admin_submenu('faqs',      'FAQ', 'help',                       $sub == 'faq');
		admin_submenu('menus',     'Menus', 'sitemap',                  $sub == 'menus');
		break;

	case 'candidats':
		admin_submenu('candidats/main_list',       'Liste principale', 'star',          $sub == 'main_list');
		admin_submenu('candidats/index',           'Tous les candidats', 'group',       $sub == 'candidats');
		admin_submenu('candidats/former_students', 'Anciens étudiants', 'user_student', $sub == 'former_students');
		admin_submenu('candidats/promotions',       'Années de promotion', 'date',      $sub == 'promotions');
		admin_submenu('emails',                    'E-mails groupés', 'email',          $sub == 'emails');
		break;

	case 'medias':
		admin_submenu('medias/files',             'Envoi de fichiers', 'folder', $sub == 'files');
		admin_submenu('medias/picture_galleries', 'Galeries photos', 'picture',  $sub == 'pictures');
		break;

	case 'config':
		admin_submenu('config/settings',            'Paramètres', 'bricks',         $sub == 'settings');
		admin_submenu('config/my_profile',          'Mon profil', 'vcard',          $sub == 'my_profile');
		admin_submenu('config/administrators',      'Administrateurs', 'user_suit', $sub == 'admins');
		admin_submenu('config/server_tools',        'Outils serveur', 'server',     $sub == 'server');
		break;
}
?>
</ul>
